import React, { PureComponent } from 'react';
import './table.less';
import tableMain from './tableDataEdit';
import moment from 'moment';
import api from '../../../../../../../api/api';
import message from '@wanhu/antd-legacy/lib/message';
// com 慢病情况 个人疾病
import ChoseSlowSickTable from './../../disease-info-edit/chose-slow-sick-table'
// com 家族疾病
import FamilyChoseSlowSickTable from './../../disease-info-edit/family-chose-slow-sick-table'
// com 诊疗情况 当前用药
import UseMedicationComponent from './../../disease-info-edit/use-medication-component'
import { Form, Input, Anchor, Icon, Select, Checkbox, Button, DatePicker, InputNumber, Upload, Modal, Radio } from 'antd';
const RadioButton = Radio.Button;
const RadioGroup = Radio.Group;
const FormItem = Form.Item;
const Option = Select.Option;
const CheckboxGroup = Checkbox.Group;
const { TextArea } = Input;
const { Link } = Anchor;
// pdf默认封面
const pdfCover = 'https://static.wanhuhealth.com/healthrecord/ec86dce5dc4c4b6e9dbf50625bb2db31.png';
function getBase64(file) {
    return new Promise((resolve, reject) => {
        const reader = new FileReader();
        reader.readAsDataURL(file);
        reader.onload = () => resolve(reader.result);
        reader.onerror = error => reject(error);
    });
}
function throttle(func, wait) {
    let prev = 0;
    return function () {
        let now = Date.now()
        if (now - prev > wait) {
            func.apply(this)
            prev = now
        }
    }
}
let timerBtn = false
// 1、eGFR
// 2、图片上传
// 3、保留整数或者两位小数 ok
// 测导航
let sildeNav = [
    {
        id: 'GeneralExamination',
        name: '一般检查'
    },
    {
        id: 'habitsAndCustoms',
        name: '生活习惯'
    },
    {
        id: 'physicalExamination',
        name: '体检指标'
    },
    {
        id: 'chronicDiseases',
        name: '慢病情况'
    },
    {
        id: 'clinicalIndicators',
        name: '临床指标'
    },
    {
        id: 'familyDisease',
        name: '家族史'
    },
    {
        id: 'allergicHistory',
        name: '过敏史'
    },
    {
        id: 'diagnosisAndTreatment',
        name: '诊疗情况'
    },
    {
        id: 'physicalSymptoms',
        name: '身体症状'
    },
    {
        id: 'psychologicalPressure',
        name: '心理压力'
    }
]
class NewTable extends PureComponent {
    constructor (props) {
        super(props)

        this.state = {
            mainData:this.props.detailData.physicalExaminationDate?JSON.parse(JSON.stringify(this.props.detailData)):JSON.parse(JSON.stringify(tableMain)),
            smokeJY:false,
            smokeYes:false,
            pointInfo:{},
            previewVisible: false,
            previewImage: '',
            fileList: [{
                uid: -1,
                name: 'xxx.png',
                status: 'done',
                url: 'https://zos.alipayobjects.com/rmsportal/jkjgkEfvpUPVyRjUImniVslZfWPnJuuZ.png',
                cover:''
            }],
            yinshiShow: false,
            exerciseModeShow: false,
            isHaveTNB: false,
            createdId: '',
            sideIndexCur: 0,
            scrollHeight: 0,
            isSaveBtnSuccess: false,
            isShowDetail: false
        }
    }
    async componentDidMount() {
        this.initMainData()
        this.initModalOffsetTop()
        if (this.state.mainData.physicalExaminationDate) {
            this.setState({
                isShowDetail:true
            })
        }
        // console.log(this.state.isShowDetail)
    }
    initModalOffsetTop() {
        // 获取可视区域高度，滚动监听最外层 scroll
        this.setState({
            scrollHeight:window.innerHeight - 10 - 48 - 20+'px'
        })
        sildeNav.map(item => {
            const getTopNum = document.getElementById(item.id).offsetTop;
            item.offsetTop = getTopNum;
            return item;
        })
    }
    //在componentWillUnmount，进行scroll事件的注销
    async initMainData() {
        let images = this.state.mainData.picUrls
        let fileImage = []
        if(images && images.length>0){
            fileImage = images.map((item,index)=>{
                return {uid:index,name:index,status:'done',url:item}
            })
        }
        // pdf格式添加默认封面
        fileImage.map(item => {
            item.cover = item.url
            if (item.url && ~item.url.indexOf('.pdf')) {
                item.url = pdfCover
            }
        })
        // 初始化饮食习惯数组，后台不支持数组……nnd

        this.BMICompute()
        let main = this.state.mainData
        // 初始化您的运动类型，后台不支持数组……nnd
        let exerciseModeData = this.state.mainData.exerciseMode
        let exerciseModeItem = []
        if(exerciseModeData && exerciseModeData>0){
            if((exerciseModeData & 1)>0){
                exerciseModeItem.push(1)
            }
            if((exerciseModeData & 2)>0){
                exerciseModeItem.push(2)
            }
            if((exerciseModeData & 4)>0){
                exerciseModeItem.push(4)
            }
            if((exerciseModeData & 8)>0){
                exerciseModeItem.push(8)
            }
            if((exerciseModeData & 16)>0){
                exerciseModeItem.push(16)
            }
            if((exerciseModeData & 32)>0){
                exerciseModeItem.push(32)
            }
            if((exerciseModeData & 64)>0){
                exerciseModeItem.push(64)
            }
            if((exerciseModeData & 128)>0){
                exerciseModeItem.push(128)
            }
            if((exerciseModeData & 256)>0){
                exerciseModeItem.push(256)
            }
            if((exerciseModeData & 512)>0){
                exerciseModeItem.push(512)
                this.setState({
                    exerciseModeShow:true
                })
            }
        }
        this.getEGFR()
        main.exerciseMode = exerciseModeItem
        // 过敏史
        const allergiesData = await api.getPatientDiseaseInfo(this.props.patientId);
        main.allergies = allergiesData.allergies
        // 初始化吸烟情况
        let smokeData = this.state.mainData.smok
        if(smokeData === 30){
            this.setState({
                smokeJY:true
            })
        }
        if(smokeData === 40){
            this.setState({
                smokeYes:true
            })
        }
        // 初始化
        this.setState({
            fileList:fileImage,
            mainData:main,
            yinshiShow:true
        })
        this.isHaveTNBsick()
    }
    getIdCardInfo(UUserCard, num) {
        if (!UUserCard) {
            return null;
        }
        if (num == 1) {
            //获取出生日期
            let birth = UUserCard.substring(6, 10) + "-" + UUserCard.substring(10, 12) + "-" + UUserCard.substring(12, 14);
            return birth;
        }
        if (num == 2) {
            //获取性别
            if (parseInt(UUserCard.substr(16, 1)) % 2 == 1) {
                //男
                return "男";
            } else {
                //女
                return "女";
            }
        }
        if (num == 3) {
            //获取年龄
            var myDate = new Date();
            var month = myDate.getMonth() + 1;
            var day = myDate.getDate();
            var age = myDate.getFullYear() - UUserCard.substring(6, 10) - 1;
            if (UUserCard.substring(10, 12) < month || UUserCard.substring(10, 12) == month && UUserCard.substring(12, 14) <= day) {
                age++;
            }
            return age;
        }
    }
    getAgeByBirthday(strBirthday) {
        /*根据出生日期算出年龄*/
        var returnAge;
        var strBirthdayArr=strBirthday.split("-");
        var birthYear = strBirthdayArr[0];
        var birthMonth = strBirthdayArr[1];
        var birthDay = strBirthdayArr[2];
        var d = new Date();
        var nowYear = d.getFullYear();
        var nowMonth = d.getMonth() + 1;
        var nowDay = d.getDate();
        if(nowYear == birthYear){
            returnAge = 0;//同年 则为0岁
        }
        else{
            var ageDiff = nowYear - birthYear ; //年之差
            if(ageDiff > 0){
                if(nowMonth == birthMonth) {
                    var dayDiff = nowDay - birthDay;//日之差
                    if(dayDiff < 0)
                    {
                        returnAge = ageDiff - 1;
                    }
                    else
                    {
                        returnAge = ageDiff ;
                    }
                }
                else
                {
                    var monthDiff = nowMonth - birthMonth;//月之差
                    if(monthDiff < 0)
                    {
                        returnAge = ageDiff - 1;
                    }
                    else
                    {
                        returnAge = ageDiff ;
                    }
                }
            }
            else
            {
                returnAge = -1;//返回-1 表示出生日期输入错误 晚于今天
            }
        }
        return returnAge;//返回周岁年龄
    }
    getEGFR() {
        const age = this.props.idCard ? +this.getIdCardInfo(this.props.idCard, 3) : +this.getAgeByBirthday(this.props.birthday)
        const sex = this.props.sex
        if((!age && age !== 0) || (!sex && sex !== 0)){
            message.error('年龄或者性别缺失，无法正常计算肾小球滤过率');
            this.state.mainData.eGFR = ''
            this.props.form.setFieldsValue({ eGFR: '' })
            return;
        }
        console.log('年龄和性别',age,sex)
        let scr = this.state.mainData.Scr
        let scrUnit = this.state.mainData.scrUnit
        this.setState({
            mainData:this.state.mainData
        })
        if(this.state.mainData.scrUnit && this.state.mainData.Scr){
            if(scrUnit === 1){
                scr /=88.41
            }
            let value = 186 * Math.pow(scr, -1.154) * Math.pow(age, -0.203) * { 1: 1, 0: 0.742 }[sex] * 1.233;
            let mainData = this.state.mainData
            mainData.eGFR = +value.toFixed(2)
            this.props.form.setFieldsValue({eGFR:mainData.eGFR});
            this.setState({
                mainData:{...mainData}
            })
        }else{
            this.state.mainData.eGFR = ''
            this.props.form.setFieldsValue({eGFR:''})
        }
    }
    handleSubmit = async (e) => {
        e.preventDefault();
        if (timerBtn) {
            return false
        }
        timerBtn = true;
        setTimeout(function () {
            timerBtn = false
        }, 3000)
        console.log(1133,timerBtn);
        this.props.form.validateFieldsAndScroll(async (err, fieldsValue) => {
            if (err) {
                console.log('Received values of form: ', fieldsValue);
                return
            }
            let values = {
                ...fieldsValue
            };
            // 时间格式转换
            if(fieldsValue['physicalExaminationDate']){
                values = {
                    ...fieldsValue,
                    'physicalExaminationDate': fieldsValue['physicalExaminationDate'].format('YYYY-MM-DD')
                };
            }
            //腰围处理
            if(values.waistlineUnit === 2){
                values.waistline =(values.waistline * 33.33).toFixed(2)
            }
            // 求饮食和
            var numbers = values.dietaryHabit || [];
            values.dietaryHabit = numbers.reduce(function(sum,number){ //sum2 前两个数的和
                return sum + number;
            }, 0)  //第一次初始化时用1000 + 数组中的第一项
            // 您的运动类型求和
            let exerciseNumber = values.exerciseMode || [];
            values.exerciseMode = exerciseNumber.reduce(function(sum,number){ //sum2 前两个数的和
                return sum + number;
            }, 0)
            // 图片传值
            values.picUrls = this.state.mainData.picUrls || [];
            values.picUrls.map(item => {
                if (item.cover && ~item.cover.indexOf('.pdf')) {
                    item.url = item.cover
                }
                return item
            })
            // 个人慢病在组件取值 choseSlowSickTableState
            let ownSlowSData = this.refs.choseSlowSickTableState.state.data;
            let newOwnSlowSData = [];
            ownSlowSData.forEach(item => {
                if (item.diseaseId) {
                    let datai = {
                        diseaseId: item.diseaseId,
                        diseaseDate: item.diseaseDate || null
                    }
                    newOwnSlowSData.push(datai)
                }
            })
            values.patientChronicDiseases = newOwnSlowSData;
            // 家庭慢病组件取值 familyChoseSlowSickTableState
            let familySlowSData = this.refs.familyChoseSlowSickTableState.state.data;
            console.log('家族病史', familySlowSData)
            let newFamilySlowSData = [];
            familySlowSData.forEach(item => {
                if (item.diseaseId) {
                    let datai = {
                        diseaseId: item.diseaseId,
                        age: item.age,
                        relation: item.relationValue || item.relation,
                        lapseToId: item.lapseToId
                    }
                    newFamilySlowSData.push(datai)
                }
            })
            // 增加慢病等
            values.patientFamilyDiseases = newFamilySlowSData;
            const userInfo = await api.getUserInfo()
            values.createBy = userInfo.user;
            values.source = 1;
            values.businessSource = 4
            const self = this
            this.allergiesSave(values.allergies);


            if (this.props.detailData.physicalExaminationDate || this.state.createdId) {
                const createdId = this.state.mainData.id || this.state.createdId || undefined;
                try {
                    await api.editPhysicalRecordListNewDetail(this.props.patientId, createdId, JSON.stringify(values));
                    Modal.success({
                        title: '更新成功',
                        onOk() {
                            self.props.initMainData(self.state.isSaveBtnSuccess);
                        },
                    });
                    this.setState({
                        isSaveBtnSuccess:true
                    })
                } catch (e) {
                    Modal.error({
                        title: e.message,
                    });
                }
            }else{
                try {
                    const data = await api.addPhysicalRecordListNewDetail(this.props.patientId, JSON.stringify(values))
                    this.setState({
                        createdId:data
                    })
                    Modal.success({
                        title: '创建成功',
                        onOk() {
                            self.props.initMainData(self.state.isSaveBtnSuccess);
                        },
                    });
                    this.setState({
                        isSaveBtnSuccess:true
                    })
                } catch (e) {
                    Modal.error({
                        title: e.message,
                    });
                }
            }
            // const edit = await api.createHealthCheckRecord(this.props.patientId,this.state.mainData,this.state.mainData.id)
        });
    }
    async allergiesSave(allergies){
        const { patientId } = this.props;
        const diseData = {
            chronicDiseases: [],
            homeMedicalHistories: [],
            allergies:allergies
        }
        try {
            await api.updateDiseaseInfo(patientId, diseData);
        }
        catch (e) {
            message.error(e.message?e.message:'过敏史保存失败，请刷新后重试');
        }
    }
    heightChange(value){
        this.state.mainData.height = value
        this.BMICompute()
    }
    weightChange(value){
        this.state.mainData.weight = value
        this.BMICompute()
        this.getEGFR()
    }
    BMICompute() {
        const { height, weight } = this.state.mainData;
        let { mainData } = this.state;
        if (height && weight) {
            mainData.BMI = (mainData.weight / (Math.pow(mainData.height, 2))).toFixed(2);
            this.setState({
                mainData: {...mainData}
            })
            this.props.form.setFieldsValue({BMI:mainData.BMI});
        } else {
            mainData.BMI = '';
            this.setState({
                mainData: {...mainData}
            })
            this.props.form.setFieldsValue({BMI:''});
        }
    }
    ScrChange(value){
        this.state.mainData.Scr = value;
        this.props.form.setFieldsValue({ Scr: value });
        this.getEGFR()
    }
    scrUnitChange(value){
        this.state.mainData.scrUnit = value
        this.state.mainData.Scr = ""
        this.props.form.setFieldsValue({Scr:""});
        this.ScrChange('')
        // this.getEGFR()
    }
    waistChange(value){
        this.state.mainData.waistlineUnit = value
        this.props.form.setFieldsValue({waistline:""});
    }
    smokeChange(value){
        this.setState({
            smokeYes:false,
            smokeJY:false
        })
        if(value === 30){
            this.setState({
                smokeJY:true
            })
            return
        }
        if(value === 40){
            this.setState({
                smokeYes:true
            })
            return
        }
    }
    normFile = (e) => {
        if (Array.isArray(e)) {
          return e;
        }
        return e && e.fileList;
    }
    handleCancel = () => this.setState({ previewVisible: false })

    imagePreview = (file) => {
        if (file.cover && ~file.cover.indexOf('.pdf')) {
            window.open(`${file.cover}`, '_blank');
            return false;
        }
        this.setState({
            previewImage: file.url || file.thumbUrl,
            previewVisible: true,
        });
    }

    imageChange = ({ fileList }) => {
        let url = window.location.href;
        let imgUrl = "https://img.wanhuhealth.com/images"
        if(url.indexOf("t-crm") >= 0 ) { //判断url地址中是否包含link字符串
            imgUrl = "http://t-img.wanhuhealth.com:8090/images"
        }
        if(url.indexOf("demo") >= 0 ) { //判断url地址中是否包含link字符串
            imgUrl = "https://img.wanhuhealth.com/images_demo"
        }
        if(url.indexOf("7003") >= 0 ) { //判断url地址中是否包含link字符串
            imgUrl = "http://10.1.10.21:8090/images"
        }
        let main = this.state.mainData
        let fileItem = fileList
        let len = fileItem.length
        if(len>0 && fileItem[len-1].response){
            fileItem[len-1]={
                uid:fileItem[len-1].uid,
                name:fileItem[len-1].name,
                status:"done",
                url:imgUrl+fileItem[len-1].response,
            }
        }
        main.picUrls = fileItem.map((item)=>{
            return item.url
        })
        // imgUrl =
        this.setState({
            fileList:[...fileItem],
            mainData:main
        })
    }
    imageChangeOss = ({ fileList }) => {
        const file = [...fileList].reverse()
        let isCheckPass = true;
        if (fileList.length>0&&file && file[0].type) {
            isCheckPass = this.handleBeforeUpload(file[0])
        }
        if (!isCheckPass) {
            return false;
        }
        const imgUrl = "https://static.wanhuhealth.com/"
        let main = this.state.mainData
        let fileItem = fileList
        let len = fileItem.length

        if(len>0 && fileItem[len-1].response){
            fileItem[len-1]={
                uid:fileItem[len-1].uid,
                name:fileItem[len-1].name,
                status:"done",
                url: imgUrl + fileItem[len - 1].response.data,
                cover:imgUrl + fileItem[len - 1].response.data
            }
        }
        main.picUrls = fileItem.map((item) => {
            if (item.cover && ~item.cover.indexOf('.pdf')) {
                return item.cover
            }
            return item.url
        })
        fileItem.map(item => {
            if ((item.url && ~item.url.indexOf('.pdf')) || (item.cover && ~item.cover.indexOf('.pdf'))) {
                item.url = pdfCover
            }
            return
        })
        // imgUrl =
        this.setState({
            fileList:[...fileItem],
            mainData:main
        })
    }
    handleBeforeUpload = file => {
        //限制图片 格式、size、分辨率
        if (!file) {return true }
        const isJPG = file.type === 'image/jpeg';
        const isJPEG = file.type === 'image/jpeg';
        const isGIF = file.type === 'image/gif';
        const isPNG = file.type === 'image/png';
        const isPDF = file.type === 'application/pdf';
        if (!(isJPG || isJPEG || isGIF || isPNG || isPDF)) {
            Modal.error({
                title: '只能上传JPG 、JPEG 、GIF、 PNG、 PDF格式的图片~',
            });
            return false;
        }
        const isLt10M = file.size / 1024 / 1024 < 10;
        if (!isLt10M) {
            Modal.error({
                title: '超过10M限制，不允许上传~',
            });
            return false;
        }
        // const preview = await getBase64(file);
        // this.setState({ preview });
        return true;
    };
    uploadFile = file => {
        const { preview } = this.state;
        const name = file.name;
        const param = {
            data: preview.substr(preview.indexOf(';base64,') + ';base64,'.length),
            suffix: name.substring(name.lastIndexOf('.') + 1, name.length),
            prefixPath: 'orderinfo',
        }
        return param;
    }
    customRequest = (fileData) => {
        api.uploadFile(fileData.data).then((res) => {
            fileData.onSuccess(res)
        }, (error) => {
            fileData.onError(error)
        });

    }
    publicChangeFun = (val, key, type) => {
        // 如果多选，需要累加处理，后台竟然不支持素组
        let data = this.state.mainData;
        if (key === 'exerciseMode') {
            let isOther = val.some(item => item === 512)
            this.setState({
                exerciseModeShow:isOther
            })
        }
        data[key] = val
        this.setState({
            mainData:data
        })
    }
    // 判断慢病中是否有"糖尿病"相关疾病
    isHaveTNBsick = async () => {
        const { own } = await api.getDiseases();
        const { chronicDiseases } = await api.getPatientDiseaseInfo(this.props.patientId);
        let TNBData = own.filter(item => ~item.name.indexOf('糖尿病'));
        const isHaveTNBdata = TNBData.filter(item => chronicDiseases.some(sickId => sickId.diseaseId === item.id))
        if (isHaveTNBdata && isHaveTNBdata.length > 0) {
            this.setState({
                isHaveTNB:true
            })
        }
    }
    // 侧边栏导航
    sideNavDom = () => {
        const { sideIndexCur } = this.state;
        const htmls = sildeNav.map((item,index) => {
            return (
                <li className={`sideList ${index === sideIndexCur?"sideListCur":''}`} onClick={() =>throttle(this.scrollToAnchor(item.id, index),1000)}>
                    <span className="listRadio"></span>
                    {item.name}
                </li>
            )
        })
        return (
            <ul className="sideBox">
                {htmls}
            </ul>
        )
    }
    // 跳转锚点函数
    scrollToAnchor = (anchorName, index) => {
        this.onScrollHandle = function () { };
        clearTimeout(timer);
        let timer;
        const self = this;
        if (anchorName) {
            // 找到锚点
            let anchorElement = document.getElementById(anchorName);
            // 如果对应id的锚点存在，就跳转到锚点
            if (anchorElement) {
                anchorElement.scrollIntoView({ block: 'start', behavior: 'smooth' });
                this.setState({
                    sideIndexCur:index
                })
                timer = setTimeout(function () {
                    self.onScrollHandle = self.initonScrollHandle;
                },800)
            }
        }
    }
    onScrollHandle = () => {
        const scrollTop = this.scrollRef.scrollTop;
        let anchorElement = document.getElementById("physicalExamination");
        sildeNav.forEach((item,index) => {
            if (scrollTop >= Number(item.offsetTop-52)) {
                this.setState({
                    sideIndexCur:index
                })
            }
        })
    }
    initonScrollHandle = () => {
        const scrollTop = this.scrollRef.scrollTop;
        let anchorElement = document.getElementById("physicalExamination");
        sildeNav.forEach((item,index) => {
            if (scrollTop >= Number(item.offsetTop-52)) {
                this.setState({
                    sideIndexCur:index
                })
            }
        })
    }
    closeModal() {
        this.props.initMainData(this.state.isSaveBtnSuccess)
    }
    render() {
        const { getFieldDecorator } = this.props.form;
        const optionsItem = [
            { label: '偏咸', value: 1 },
            { label: '偏甜', value: 2 },
            { label: '偏油', value: 4 },
            { label: '清淡', value: 8 }
        ];
        const exerciseOptions = [
            { label: '步行', value: 1 },
            { label: '快走', value: 2 },
            { label: '骑车', value: 4 },
            { label: '游泳', value: 8 },
            { label: '跑步', value: 16 },
            { label: '瑜伽', value: 32 },
            { label: '登山', value: 64 },
            { label: '球类运动', value: 128 },
            { label: '核心/力量训练', value: 256 },
            { label: '其他', value: 512 },
        ]
        const formItemLayout = {
            labelCol: {
              xs: { span: 24 },
              sm: { span: 6 },
            },
            wrapperCol: {
              xs: { span: 24 },
              sm: { span: 17 },
            },
        };
        const formItemLayoutNei = {
            labelCol: {
              xs: { span: 24 },
              sm: { span: 14 },
            },
            wrapperCol: {
              xs: { span: 24 },
              sm: { span: 17 },
            },
        }
        const dateFormat = 'YYYY-MM-DD';
        let mainData = this.state.mainData
        const { previewVisible, previewImage, fileList, isHaveTNB } = this.state;
        const uploadButton = (
        <div>
            <Icon type="plus" />
            <div className="ant-upload-text">上传</div>
        </div>
        );
        return (
            <div>
                <div className={[mainData.physicalExaminationDate && !this.props.editPower?"tableNoEdit":'']}>
                    <div className="tables healthTables"
                    onScrollCapture={() => this.onScrollHandle()}
                    style={{ maxHeight: this.state.scrollHeight, overflowY: 'scroll' }}
                    ref={c => {
                        this.scrollRef = c;
                    }}
                    >
                        {this.sideNavDom()}
                        {/* <Form onSubmit={debounce(() =>this.handleSubmit(),3000)}> */}
                        <Form onSubmit={this.handleSubmit}>
                            <div className={ 'one'}>
                                <FormItem
                                    {...formItemLayout}
                                        label="建档日期"
                                    >
                                    {getFieldDecorator('physicalExaminationDate', {
                                        initialValue:mainData.physicalExaminationDate?moment(mainData.physicalExaminationDate, dateFormat):'',
                                        rules: [{required: true, message: '时间不能为空'}],
                                    })(
                                        <DatePicker />
                                    )}
                                </FormItem>
                                <div className="title" id="GeneralExamination">一般检查指标</div>
                                <FormItem
                                    {...formItemLayout}
                                        label="身高"
                                    >
                                    {getFieldDecorator('height', { initialValue:mainData.height, rules: [{pattern:new RegExp(/^(([1-9]{1}\d*)|(0{1}))(\.\d{1,2})?$/), message: '最多保留2位小数'}],})(
                                        <InputNumber min={0.5} max={3} onChange={this.heightChange.bind(this)} />
                                    )}
                                    米
                                </FormItem>
                                <FormItem
                                    {...formItemLayout}
                                        label="体重"
                                    >
                                    {getFieldDecorator('weight', {
                                        initialValue:mainData.weight, rules: [{pattern:new RegExp(/^(([1-9]{1}\d*)|(0{1}))(\.\d{1,2})?$/), message: '最多保留2位小数'}],
                                    })(
                                        <InputNumber min={20} max={200} onChange={this.weightChange.bind(this)} />
                                    )}
                                    公斤
                                </FormItem>
                                <FormItem
                                    {...formItemLayout}
                                        label="腰围"
                                    >
                                    {this.state.mainData.waistlineUnit===2?getFieldDecorator('waistline', { initialValue:mainData.waistline, rules: [{pattern:new RegExp(/^(([1-9]{1}\d*)|(0{1}))(\.\d{1,2})?$/), message: '最多保留2位小数'}],})(
                                        <InputNumber min={1} max={6} />
                                    ):getFieldDecorator('waistline', { initialValue:mainData.waistline, rules: [{pattern:new RegExp(/^(([1-9]{1}\d*)|(0{1}))(\.\d{1,2})?$/), message: '最多保留2位小数'}],})(
                                        <InputNumber min={30} max={200} />
                                    )}
                                    {getFieldDecorator('waistlineUnit', { initialValue:mainData.waistlineUnit?mainData.waistlineUnit:1, rules: [{required: false, message: '不能为空'}],})(
                                        <Select placeholder="单位" className="widthCommon" getPopupContainer={triggerNode => triggerNode.parentNode}  onChange={this.waistChange.bind(this)} >
                                            <Option value={1}>厘米</Option>
                                            <Option value={2}>尺</Option>
                                        </Select>
                                    )}
                                </FormItem>
                                <FormItem
                                    {...formItemLayout}
                                        label="BMI指数"
                                    >
                                    {getFieldDecorator('BMI', { initialValue:mainData.BMI?mainData.BMI:'', rules: [{required: false, message: '不能为空'}],})(
                                        <InputNumber disabled={true}/>
                                    )}
                                </FormItem>
                                <div className={'three'}>
                                    <div className="title getOffsetTop" id="habitsAndCustoms">生活习惯</div>
                                    <div className="title-smal">饮食</div>
                                    <FormItem
                                        {...formItemLayout}
                                            label="饮食口味"
                                        >
                                        {getFieldDecorator('dietaryHabit', { initialValue:mainData.dietaryHabit, rules: [{required: false, message: '不能为空'}],})(
                                            <CheckboxGroup className="smokeRight" options={optionsItem} />
                                        )}
                                    </FormItem>
                                    <FormItem
                                        {...formItemLayout}
                                            label="主食摄入习惯"
                                        >
                                        {getFieldDecorator('stapleFood', { initialValue:mainData.stapleFood, rules: [{required: false, message: '不能为空'}],})(
                                            <Select placeholder="" className="widthCommon" getPopupContainer={triggerNode => triggerNode.parentNode}>
                                                <Option value={0}>否</Option>
                                                <Option value={1}>是</Option>
                                            </Select>
                                        )}
                                        <span> 主食粗、细搭配</span>
                                    </FormItem>
                                    <FormItem
                                        {...formItemLayout}
                                            label="荤、素饮食习惯"
                                        >
                                        {getFieldDecorator('meatVegetable', { initialValue:mainData.meatVegetable, rules: [{required: false, message: '不能为空'}],})(
                                            <Select placeholder="" className="widthCommon" getPopupContainer={triggerNode => triggerNode.parentNode}>
                                                <Option value={10}>偏荤</Option>
                                                <Option value={20}>偏素</Option>
                                                <Option value={30}>荤素搭配</Option>
                                            </Select>
                                        )}
                                    </FormItem>
                                    <FormItem
                                        {...formItemLayout}
                                            label="肉食习惯"
                                        >
                                        {getFieldDecorator('eatMeat', { initialValue:mainData.eatMeat, rules: [{required: false, message: '不能为空'}],})(
                                            <Select placeholder="" className="widthCommon" getPopupContainer={triggerNode => triggerNode.parentNode}>
                                                <Option value={10}>主要红肉</Option>
                                                <Option value={20}>主要白肉</Option>
                                                <Option value={30}>红白搭配</Option>
                                                <Option value={40}>不吃肉</Option>
                                            </Select>
                                        )}
                                        <span> 红肉（猪牛羊肉）、白肉（鸡鸭鱼肉）</span>
                                    </FormItem>
                                    <FormItem
                                        {...formItemLayout}
                                            label="新鲜蔬菜、水果摄入情况"
                                        >
                                        {getFieldDecorator('vegetableFruit', { initialValue:mainData.vegetableFruit, rules: [{required: false, message: '不能为空'}],})(
                                            <Select placeholder="" className="widthCommon" getPopupContainer={triggerNode => triggerNode.parentNode}>
                                                <Option value={10}>几乎从不</Option>
                                                <Option value={20}>偶尔</Option>
                                                <Option value={30}>经常</Option>
                                            </Select>
                                        )}
                                    </FormItem>
                                    <FormItem
                                        {...formItemLayout}
                                            label="日常饮水习惯"
                                        >
                                        {getFieldDecorator('drinking', { initialValue:mainData.drinking, rules: [{required: false, message: '不能为空'}],})(
                                            <Select placeholder="" className="widthCommon" onChange={(value) => this.publicChangeFun(value,'drinking')} getPopupContainer={triggerNode => triggerNode.parentNode}>
                                                <Option value={10}>口渴了才会喝水</Option>
                                                <Option value={20}>每天主动喝水1-2杯</Option>
                                                <Option value={30}>每天主动喝水3-4杯</Option>
                                                <Option value={40}>每天主动喝水5杯及以上</Option>
                                            </Select>
                                        )}
                                        { mainData.drinking === 20 || mainData.drinking === 30 ||mainData.drinking === 40?<span className="padL10"> 300ml容量杯</span>:null}
                                    </FormItem>
                                    <div className="title-smal">饮酒</div>
                                    <FormItem
                                        {...formItemLayout}
                                            label="饮酒情况"
                                        >
                                        {getFieldDecorator('drink', { initialValue:mainData.drink, rules: [{required: false, message: '不能为空'}],})(
                                            <Select placeholder="" className="widthCommon" onChange={(value) => this.publicChangeFun(value,'drink')} getPopupContainer={triggerNode => triggerNode.parentNode}>
                                                <Option value={10}>几乎从不</Option>
                                                <Option value={20}>偶尔</Option>
                                                <Option title="经常,少量(每日饮酒量:啤酒不超过250ml或葡萄酒不超过100ml,或白酒不超过一两)" value={30}>经常,少量</Option>
                                                <Option title="经常,中量(每日饮酒量:啤酒250ml-500ml或葡萄酒100ml-200ml,或白酒一两到二两)" value={40}>经常,中量</Option>
                                                <Option title="长期嗜酒(每日饮酒量:啤酒大于500ml或葡萄酒大于200ml,或白酒大于二两)" value={50}>长期嗜酒</Option>
                                            </Select>
                                        )}
                                        { mainData.drink === 30?<span className="padL10">(每日饮酒量:啤酒不超过250ml或葡萄酒不超过100ml,或白酒不超过一两)</span>:null}
                                        { mainData.drink === 40?<span className="padL10">(每日饮酒量:啤酒250ml-500ml或葡萄酒100ml-200ml,或白酒一两到二两)</span>:null}
                                        { mainData.drink === 50?<span className="padL10">(每日饮酒量:啤酒大于500ml或葡萄酒大于200ml,或白酒大于二两)</span>:null}
                                    </FormItem>
                                    <div className="title-smal">抽烟</div>
                                    <FormItem
                                        {...formItemLayout}
                                            label="吸烟情况"
                                        >
                                        {getFieldDecorator('smok', { initialValue:mainData.smok, rules: [{required: false, message: '不能为空'}],})(
                                            <Select placeholder="" className="widthCommon" onChange={this.smokeChange.bind(this)} getPopupContainer={triggerNode => triggerNode.parentNode}>
                                                <Option value={10}>从未</Option>
                                                <Option value={20}>不吸烟但经常吸二手烟</Option>
                                                <Option value={30}>已戒烟</Option>
                                                <Option value={40}>是的</Option>
                                            </Select>
                                        )}
                                        {this.state.smokeJY?<div className="smokeRight">
                                            戒烟 {getFieldDecorator('quitSmokingYear', { initialValue:mainData.quitSmokingYear, rules: [{required: false, message: '不能为空'}],})(
                                                <InputNumber min={0} max={300} />
                                            )} 年
                                            之前抽烟 {getFieldDecorator('preSmokingYear', { initialValue:mainData.preSmokingYear, rules: [{required: false, message: '不能为空'}],})(
                                                <InputNumber min={0} max={300} />
                                            )} 年
                                            每天 {getFieldDecorator('preSmokingBags', { initialValue:mainData.preSmokingBags, rules: [{required: false, message: '不能为空'}],})(
                                                <InputNumber min={0} max={300} />
                                            )} 包
                                        </div>:null}
                                        {this.state.smokeYes?<div className="smokeRight">
                                            抽烟 {getFieldDecorator('smokingYear', { initialValue:mainData.smokingYear, rules: [{required: false, message: '不能为空'}],})(
                                                <InputNumber min={0} max={300} />
                                            )} 年
                                            每天 {getFieldDecorator('smokingBags', { initialValue:mainData.smokingBags, rules: [{required: false, message: '不能为空'}],})(
                                                <InputNumber min={0} max={300} />
                                            )} 包
                                        </div>:null}
                                    </FormItem>
                                    <div className="title-smal">运动</div>
                                    <FormItem
                                        {...formItemLayout}
                                            label="中等运动情况"
                                        >
                                        {getFieldDecorator('isExercise', { initialValue:mainData.isExercise, rules: [{required: false, message: '不能为空'}],})(
                                            <Select placeholder="" className="widthCommon" onChange={(value) => this.publicChangeFun(value,'isExercise')} getPopupContainer={triggerNode => triggerNode.parentNode}>
                                                <Option title="几乎从不" value={10}>几乎从不</Option>
                                                <Option title="偶尔" value={20}>偶尔</Option>
                                                <Option title="经常" value={30}>经常</Option>
                                                <Option title="总是" value={40}>总是</Option>
                                            </Select>
                                        )}
                                        { mainData.isExercise === 10?<span className="padL10">(一周内基本没有一天达到或超过20分钟的运动)</span>:null}
                                        { mainData.isExercise === 20?<span className="padL10">(每周1-2次达到或超过20分钟以上的专门运动)</span>:null}
                                        { mainData.isExercise === 30?<span className="padL10">(每周3次以上达到或超过20分钟的专门运动)</span>:null}
                                        { mainData.isExercise === 40?<span className="padL10">(几乎每天都达到或超过20分钟的专门运动)</span>:null}
                                    </FormItem>
                                    {this.state.yinshiShow?<FormItem
                                        {...formItemLayout}
                                            label="运动类型"
                                        >
                                        {getFieldDecorator('exerciseMode', { initialValue:mainData.exerciseMode, rules: [{required: false, message: '不能为空'}],})(
                                            <CheckboxGroup className="smokeRight" options={exerciseOptions} onChange={(value) => this.publicChangeFun(value,'exerciseMode','arrType')} />
                                        )}
                                        { this.state.exerciseModeShow ? getFieldDecorator('exerciseModeOther', { initialValue:mainData.exerciseModeOther, rules: [{required: false, message: '不能为空'}],})(
                                            <TextArea maxLength={20} placeholder="请输入其他运动方式" />
                                        ):null}

                                    </FormItem>:null}
                                    <div className="title-smal">睡眠</div>
                                    <FormItem
                                        {...formItemLayout}
                                            label="您每天睡眠时长是多少小时"
                                        >
                                        {getFieldDecorator('sleepTime', { initialValue:mainData.sleepTime, rules: [{required: false, message: '不能为空'}],})(
                                            <Select placeholder="" className="widthCommon" getPopupContainer={triggerNode => triggerNode.parentNode}>
                                                <Option value={10}>不足6个小时</Option>
                                                <Option value={20}>6-7个小时</Option>
                                                <Option value={30}>7-8个小时</Option>
                                                <Option value={40}>8个小时以上</Option>
                                            </Select>
                                        )}
                                    </FormItem>
                                    <FormItem
                                        {...formItemLayout}
                                            label="睡眠质量"
                                        >
                                        {getFieldDecorator('sleep', { initialValue:mainData.sleep, rules: [{required: false, message: '不能为空'}],})(
                                            <Select placeholder="" className="widthCommon" getPopupContainer={triggerNode => triggerNode.parentNode}>
                                                <Option value={1}>一觉到天亮</Option>
                                                <Option value={2}>早醒后难入睡</Option>
                                                <Option value={3}>入睡困难</Option>
                                                <Option value={4}>多梦，常醒</Option>
                                            </Select>
                                        )}
                                    </FormItem>
                                    <FormItem
                                        {...formItemLayout}
                                            label="睡觉是否打鼾"
                                        >
                                        {getFieldDecorator('snore', { initialValue:mainData.snore, rules: [{required: false, message: '不能为空'}],})(
                                            <Select placeholder="" className="widthCommon" getPopupContainer={triggerNode => triggerNode.parentNode}>
                                                <Option value={1}>打鼾</Option>
                                                <Option value={2}>打鼾伴呼吸暂停</Option>
                                                <Option value={3}>无</Option>
                                            </Select>
                                        )}
                                    </FormItem>
                                    {/* 暂时隐藏日常工作或运动量，可能以后还用 */}
                                    {/* <FormItem
                                        {...formItemLayout}
                                            label="日常工作或运动量"
                                        >
                                        {getFieldDecorator('dailyWork', { initialValue:mainData.dailyWork, rules: [{required: false, message: '不能为空'}],})(
                                            <Select placeholder="" className="widthCommon" getPopupContainer={triggerNode => triggerNode.parentNode}>
                                                <Option value={1}>轻(大部分坐着或日常居家)</Option>
                                                <Option value={2}>中(坐、走频繁重复)</Option>
                                                <Option value={3}>重(大部分站着或走动)</Option>
                                                <Option value={4}>超重(须用全身肌肉)</Option>
                                            </Select>
                                        )}
                                    </FormItem> */}
                                    {/* <FormItem
                                        {...formItemLayout}
                                            label="便秘"
                                        >
                                        {getFieldDecorator('constipation', { initialValue:mainData.constipation, rules: [{required: false, message: '不能为空'}],})(
                                            <Select placeholder="" className="widthCommon" getPopupContainer={triggerNode => triggerNode.parentNode}>
                                                <Option value={1}>是</Option>
                                                <Option value={2}>否</Option>
                                            </Select>
                                        )}
                                    </FormItem> */}
                                    {/* 暂时隐藏饮食营养 以后可能还用*/}
                                    {/* <FormItem
                                        {...formItemLayout}
                                            label="饮食营养"
                                        >
                                        {getFieldDecorator('nutrition', { initialValue:mainData.nutrition, rules: [{required: false, message: '不能为空'}],})(
                                            <Select placeholder="" className="widthCommon" getPopupContainer={triggerNode => triggerNode.parentNode}>
                                                <Option value={1}>均衡(荤素搭配较好)</Option>
                                                <Option value={2}>偏食(偏荤/偏素/纯素食)</Option>
                                                <Option value={3}>应酬多食量大</Option>
                                            </Select>
                                        )}
                                    </FormItem> */}

                                </div>
                                <div className="title getOffsetTop" id="physicalExamination">体检指标</div>
                                <div className="title-smal">血脂</div>
                                <FormItem
                                    {...formItemLayout}
                                        label="总胆固醇"
                                    >
                                    {getFieldDecorator('TCHO', { initialValue:mainData.TCHO, rules: [{pattern:new RegExp(/^(([1-9]{1}\d*)|(0{1}))(\.\d{1,2})?$/), message: '最多保留2位小数'}]})(
                                        <InputNumber min={0.01} max={15} />
                                    )} mmol/L
                                </FormItem>
                                <FormItem
                                    {...formItemLayout}
                                        label="甘油三酯"
                                    >
                                    {getFieldDecorator('TG', { initialValue:mainData.TG, rules: [{pattern:new RegExp(/^(([1-9]{1}\d*)|(0{1}))(\.\d{1,2})?$/), message: '最多保留2位小数'}],})(
                                        <InputNumber min={0.01} max={12} />
                                    )} mmol/L
                                </FormItem>
                                <FormItem
                                    {...formItemLayout}
                                        label="高密度脂蛋白胆固醇"
                                    >
                                    {getFieldDecorator('HDL', { initialValue:mainData.HDL, rules: [{pattern:new RegExp(/^(([1-9]{1}\d*)|(0{1}))(\.\d{1,2})?$/), message: '最多保留2位小数'}],})(
                                        <InputNumber min={0.01} max={3} />
                                    )} mmol/L
                                </FormItem>
                                <FormItem
                                    {...formItemLayout}
                                        label="低密度脂蛋白胆固醇"
                                    >
                                    {getFieldDecorator('LDL', { initialValue:mainData.LDL, rules: [{pattern:new RegExp(/^(([1-9]{1}\d*)|(0{1}))(\.\d{1,2})?$/), message: '最多保留2位小数'}],})(
                                        <InputNumber min={0.01} max={6} />
                                    )} mmol/L
                                </FormItem>
                                <div>
                                    <div className="title-smal">糖尿病检查</div>
                                    <FormItem
                                    {...formItemLayout}
                                        label="糖化血红蛋白"
                                    >
                                    {getFieldDecorator('HBALC', { initialValue:mainData.HBALC, rules: [{pattern:new RegExp(/^(([1-9]{1}\d*)|(0{1}))(\.\d{1,1})?$/), message: '最多保留1位小数'}]})(
                                        <InputNumber min={3} max={20} />
                                    )} %
                                </FormItem></div>
                                <div className="title-smal">肝脏检查</div>
                                <FormItem
                                    className="labelRows"
                                    {...formItemLayout}
                                        label="谷丙转氨酶(丙氨酸氨基转移酶ALT)"
                                    >
                                    {getFieldDecorator('ALT', { initialValue:mainData.ALT, rules: [{pattern:new RegExp(/^(([1-9]{1}\d*)|(0{1}))(\.\d{1,1})?$/), message: '最多保留1位小数'}],})(
                                        <InputNumber min={0} max={5000} />
                                    )}U/L
                                </FormItem>
                                <FormItem
                                    className="labelRows"
                                    {...formItemLayout}
                                        label="谷草转氨酶(天门冬氨酸氨基转移酶AST)"
                                    >
                                    {getFieldDecorator('AST', { initialValue:mainData.AST, rules: [{pattern:new RegExp(/^(([1-9]{1}\d*)|(0{1}))(\.\d{1,1})?$/), message: '最多保留1位小数'}],})(
                                        <InputNumber min={0} max={5000} />
                                    )}U/L
                                </FormItem>
                                {/* <FormItem
                                    {...formItemLayout}
                                        label="口腔检查(牙周病程度等)"
                                    >
                                    {getFieldDecorator('oralExamination', { initialValue:mainData.oralExamination, rules: [{required: false, message: '不能为空'}],})(
                                        <TextArea maxLength={200} placeholder="例如，牙齿个数； 牙周炎程度：轻/中/重" />
                                    )}
                                </FormItem> */}
                                {/* <FormItem
                                    {...formItemLayout}
                                        label="足部检查(两侧对照：足背动脉/胫后动脉等)"
                                    >
                                    {getFieldDecorator('footExamination', { initialValue:mainData.footExamination, rules: [{required: false, message: '不能为空'}],})(
                                        <TextArea maxLength={200} placeholder="例如，各部位有无水肿" />
                                    )}
                                </FormItem> */}
                                <div className="title-smal">肾脏检查</div>
                                <FormItem
                                    {...formItemLayout}
                                    label="血肌酐"
                                >
                                    {mainData.scrUnit === 1 ? getFieldDecorator('Scr', { initialValue: mainData.Scr, rules: [{ pattern: new RegExp(/^(([1-9]{1}\d*)|(0{1}))(\.\d{1,2})?$/), message: '最多保留2位小数' }], })(
                                        <InputNumber min={5} max={5000} onChange={this.ScrChange.bind(this)} />
                                    ) : getFieldDecorator('Scr', { initialValue: mainData.Scr, rules: [{ pattern: new RegExp(/^(([1-9]{1}\d*)|(0{1}))(\.\d{1,2})?$/), message: '最多保留2位小数' }], })(
                                        <InputNumber min={0.06} max={56} onChange={this.ScrChange.bind(this)} />
                                    )}
                                    {getFieldDecorator('scrUnit', { initialValue: mainData.scrUnit, rules: [{ required: false, message: '不能为空' }], })(
                                        <Select placeholder="单位" className="widthCommon" onChange={this.scrUnitChange.bind(this)} getPopupContainer={triggerNode => triggerNode.parentNode}>
                                            <Option value={1}>umol/L</Option>
                                            <Option value={2}>mg/dl</Option>
                                        </Select>
                                    )}
                                </FormItem>
                                <FormItem
                                    {...formItemLayout}
                                    label="肾小球滤过率"
                                >
                                    {getFieldDecorator('eGFR', { initialValue: mainData.eGFR ? mainData.eGFR : '', rules: [{ required: false, message: '不能为空' }], })(
                                        <InputNumber disabled={true} />
                                        )} ml/min/1.73m²
                                </FormItem>
                                <FormItem
                                    {...formItemLayout}
                                        label="尿酸"
                                    >
                                    {getFieldDecorator('uricAcid', { initialValue:mainData.uricAcid, rules: [{pattern:new RegExp(/^(([1-9]{1}\d*)|(0{1}))(\.\d{1,1})?$/), message: '最多保留1位小数'}]})(
                                        <InputNumber min={30} max={5000} />
                                    )} μmol/L
                                </FormItem>
                                <FormItem
                                    {...formItemLayout}
                                        label="尿微量白蛋白"
                                    >
                                    {getFieldDecorator('MAU', { initialValue:mainData.MAU, rules: [{pattern:new RegExp(/^(([1-9]{1}\d*)|(0{1}))(\.\d{1,2})?$/), message: '最多保留2位小数'}],})(
                                        <InputNumber min={0.01} max={2000} />
                                    )} mg/L
                                </FormItem>
                                <div className="title-smal">胃部检测</div>
                                <FormItem
                                    {...formItemLayout}
                                        label="幽门螺旋杆菌检查结果"
                                    >
                                    {getFieldDecorator('hPylori', { initialValue:mainData.hPylori, rules: [{required: false, message: '不能为空'}],})(
                                        <Select placeholder="" className="widthCommon" getPopupContainer={triggerNode => triggerNode.parentNode}>
                                            <Option value={10}>阳性</Option>
                                            <Option value={20}>阴性</Option>
                                            <Option value={30}>没测过</Option>
                                        </Select>
                                    )}
                                </FormItem>
                                {/* <div className="title-smal">眼底检查</div>
                                <FormItem
                                    {...formItemLayout}
                                        label="眼底检查结果"
                                    >
                                    {getFieldDecorator('fundoscopy', { initialValue:mainData.fundoscopy, rules: [{required: false, message: '不能为空'}],})(
                                        <TextArea maxLength={200} placeholder="例如，眼底小动脉有或无硬化" />
                                    )}
                                </FormItem> */}
                                <div className="title-smal">电解质检查</div>
                                <FormItem
                                    {...formItemLayout}
                                        label="血钠"
                                    >
                                    {getFieldDecorator('serumNa', { initialValue:mainData.serumNa, rules: [{pattern:new RegExp(/^(([1-9]{1}\d*)|(0{1}))(\.\d{1,2})?$/), message: '最多保留2位小数'}],})(
                                        <InputNumber min={50} max={1200} />
                                    )} mmol/L
                                </FormItem>
                                <FormItem
                                    {...formItemLayout}
                                    label="血钾"
                                >
                                    {getFieldDecorator('serumKalium', { initialValue: mainData.serumKalium, rules: [{ pattern: new RegExp(/^(([1-9]{1}\d*)|(0{1}))(\.\d{1,2})?$/), message: '最多保留2位小数' }], })(
                                        <InputNumber min={2} max={12} />
                                    )} mmol/L
                                </FormItem>
                                <div className="title-smal">其他检查</div>
                                <FormItem
                                    {...formItemLayout}
                                        label="血浆同型半胱氨酸"
                                    >
                                    {getFieldDecorator('Hcy', { initialValue:mainData.Hcy, rules: [{pattern:new RegExp(/^(([1-9]{1}\d*)|(0{1}))(\.\d{1,2})?$/), message: '最多保留2位小数'}],})(
                                        <InputNumber min={0} max={500} />
                                    )} μmol/L
                                </FormItem>
                                <div className="title-smal">常规检查</div>
                                {/* <FormItem
                                    {...formItemLayout}
                                        label="听诊(颈动脉/甲状腺/双肺/心脏查体(心律/心音等))"
                                    >
                                    {getFieldDecorator('auscultation', { initialValue:mainData.auscultation, rules: [{required: false, message: '不能为空'}],})(
                                        <TextArea maxLength={200} placeholder="例如，血管杂音有无以及部位；肺部啰音有无以及左肺/右肺、干性/湿性；心律是否失常" />
                                    )}
                                </FormItem> */}
                                <FormItem
                                {...formItemLayout}
                                className="labelRows"
                                label="血常规/尿常规/心电图/双手合十照片/全身照/颜面(含颈部)照片/其他实验室检查"
                                extra=""
                                >
                                <Upload
                                    accept="image/png, image/jpeg, application/pdf"
                                    name="upload"
                                    listType="picture-card"
                                    // beforeUpload={this.handleBeforeUpload}
                                    fileList={this.state.fileList}
                                    onPreview={this.imagePreview}
                                    onChange={this.imageChangeOss}
                                    action="_api/oss/upload"
                                    >
                                    {fileList.length >= 5 ? null : uploadButton}
                                </Upload>
                                {/* <Upload
                                    accept="image/png, image/jpeg, application/pdf"
                                    customRequest={this.customRequest}
                                    listType="picture-card"
                                    fileList={this.state.fileList}
                                    onPreview={this.imagePreview}
                                    onChange={this.imageChange}
                                    action="_api/uploadImages"
                                    beforeUpload={this.handleBeforeUpload}
                                    data={this.uploadFile}
                                    >
                                    {fileList.length >= 5 ? null : uploadButton}
                                </Upload> */}
                                <Modal visible={previewVisible} footer={null} onCancel={this.handleCancel}>
                                <img alt="example" style={{ width: '100%' }} src={previewImage} />
                                </Modal>
                                </FormItem>
                            </div>
                            {/* <div className="title">添加体检记录</div> */}
                            <div className={'two'}>
                                <div className="title getOffsetTop" id="chronicDiseases">慢病情况</div>
                                <FormItem
                                    className="labelRows"
                                    {...formItemLayout}
                                        label="身体状况"
                                    >
                                    {getFieldDecorator('isSick', { initialValue:mainData.isSick, rules: [{required: false, message: '不能为空'}],})(
                                        <RadioGroup size="large">
                                            <RadioButton value={0}>健康</RadioButton>
                                            <RadioButton value={1}>已确诊患病</RadioButton>
                                        </RadioGroup>
                                    )}
                                </FormItem>
                                <div className="comSick noEditPower"><ChoseSlowSickTable patientId={this.props.patientId} ref="choseSlowSickTableState" dataMain={ mainData.patientChronicDiseases }></ChoseSlowSickTable></div>
                                <div className="title getOffsetTop" id="clinicalIndicators">临床指标</div>
                                <div className="title-smal">血压</div>
                                <FormItem
                                    {...formItemLayout}
                                    label="收缩压(高压)"
                                    >
                                    {getFieldDecorator('SBP', { initialValue:mainData.SBP, rules: [{pattern:new RegExp(/^[0-9]\d*$/), message: '请输入正整数'}],})(
                                    <InputNumber min={0} max={250} />
                                    )} mmHg
                                </FormItem>
                                <FormItem
                                    {...formItemLayout}
                                    label="舒张压(低压)"
                                    >
                                        {getFieldDecorator('DBP', { initialValue:mainData.DBP, rules: [{pattern:new RegExp(/^[0-9]\d*$/), message: '请输入正整数'}],})(
                                    <InputNumber min={0} max={250} />
                                    )} mmHg
                                </FormItem>
                                <div className="title-smal">血糖</div>
                                <FormItem
                                    {...formItemLayout}
                                    label="空腹血糖"
                                    >
                                    {getFieldDecorator('FBG', { initialValue:mainData.FBG, rules:[{pattern:new RegExp(/^(([1-9]{1}\d*)|(0{1}))(\.\d{1,1})?$/), message: '最多保留1位小数'}],
                                    })(
                                        <InputNumber min={0.1} max={15} />
                                    )} mmol/L
                                </FormItem>
                                <FormItem
                                    {...formItemLayout}
                                    label="餐后两小时血糖"
                                    >
                                    {getFieldDecorator('PBG', { initialValue:mainData.PBG, rules: [{pattern:new RegExp(/^(([1-9]{1}\d*)|(0{1}))(\.\d{1,1})?$/), message: '最多保留1位小数'}],
                                    })(
                                        <InputNumber min={0.1} max={15} />
                                    )} mmol/L
                                </FormItem>
                                <div className="title-smal">心率</div>
                                <FormItem
                                    {...formItemLayout}
                                        label="心率"
                                    >
                                    {getFieldDecorator('heartRate', { initialValue:mainData.heartRate, rules:
                                        [{pattern:new RegExp(/^[0-9]\d*$/), message: '请输入正整数'}],
                                    })(
                                        <InputNumber min={30} max={200} />
                                    )} (次/分钟)
                                </FormItem>
                                <div className="title getOffsetTop" id="familyDisease">
                                    家族史
                                </div>
                                <div className="comSick noEditPower"><FamilyChoseSlowSickTable patientId={ this.props.patientId} ref="familyChoseSlowSickTableState" dataMain={ mainData.patientFamilyDiseases }></FamilyChoseSlowSickTable></div>
                                <div className="title getOffsetTop" id="allergicHistory">过敏史</div>
                                <FormItem
                                    {...formItemLayout}
                                        label="过敏史"
                                    >
                                    {getFieldDecorator('allergies', { initialValue:mainData.allergies, rules: [{required: false, message: '不能为空'}],})(
                                        <TextArea maxLength={200} placeholder="请录入过敏史" />
                                    )}
                                    <div className="drug-demand-link" style={{ marginTop:'10px '}}>
                                        <Icon type="exclamation-circle" theme="outlined" />
                                        合并用药登记
                                        【<span style={{color: 'red'}}>过敏史</span>】
                                    </div>
                                </FormItem>
                                <div className="title getOffsetTop" id="diagnosisAndTreatment">诊疗情况</div>
                                <FormItem
                                    className="labelRows"
                                    {...formItemLayout}
                                        label="目前是否在服用药物"
                                    >
                                    {getFieldDecorator('useDrug', { initialValue:mainData.useDrug, rules: [{required: false, message: '不能为空'}],})(
                                        <RadioGroup size="large">
                                            <RadioButton value={0}>否</RadioButton>
                                            <RadioButton value={1}>是</RadioButton>
                                        </RadioGroup>
                                    )}
                                </FormItem>
                                <div className="comSick">
                                    <UseMedicationComponent patientId={this.props.patientId} ref="UseMedicationComponent"></UseMedicationComponent>
                                    <div className="drug-demand-link" style={{ marginTop:'10px '}}>
                                        <Icon type="exclamation-circle" theme="outlined" />
                                        用药内容请在
                                        【<span style={{color: 'red'}}>规律用药</span>】
                                        模块中添加
                                    </div>
                                </div>
                                <div className="title getOffsetTop" id="physicalSymptoms">身体症状</div>
                                <FormItem
                                    className="labelRows"
                                    {...formItemLayout}
                                        label="进食哽咽感或吞咽困难"
                                    >
                                    {getFieldDecorator('dysphagia', { initialValue:mainData.dysphagia, rules: [{required: false, message: '不能为空'}],})(
                                        <RadioGroup size="large">
                                            <RadioButton value={0}>否</RadioButton>
                                            <RadioButton value={1}>是</RadioButton>
                                        </RadioGroup>
                                    )}
                                </FormItem>
                                <FormItem
                                    className="labelRows"
                                    {...formItemLayout}
                                        label="大便习惯的改变"
                                    >
                                    {getFieldDecorator('stoolAbnormity', { initialValue:mainData.stoolAbnormity, rules: [{required: false, message: '不能为空'}],})(
                                        <RadioGroup size="large">
                                            <RadioButton value={0}>否</RadioButton>
                                            <RadioButton value={1}>是</RadioButton>
                                        </RadioGroup>
                                    )}
                                    （大便习惯改变包括：腹泻与便秘交替出现、排便次数、大便形状、排便量等）
                                </FormItem>
                                <FormItem
                                    className="labelRows"
                                    {...formItemLayout}
                                        label="右上腹（肝区）是否有阵发性疼痛"
                                    >
                                    {getFieldDecorator('rightUpperQuadrantPain', { initialValue:mainData.rightUpperQuadrantPain, rules: [{required: false, message: '不能为空'}],})(
                                        <RadioGroup size="large">
                                            <RadioButton value={0}>否</RadioButton>
                                            <RadioButton value={1}>是</RadioButton>
                                        </RadioGroup>
                                    )}
                                </FormItem>
                                {/* 只有女性展示 */}
                                <FormItem
                                className="labelRows"
                                {...formItemLayout}
                                    label="乳腺是否有不适或肿块"
                                >
                                    {getFieldDecorator('breastLump', { initialValue:mainData.breastLump, rules: [{required: false, message: '不能为空'}],})(
                                        <RadioGroup size="large">
                                            <RadioButton value={0}>否</RadioButton>
                                            <RadioButton value={1}>是</RadioButton>
                                        </RadioGroup>
                                    )}
                                </FormItem>
                                <div className="title" id="psychologicalPressure">心理压力</div>
                                <FormItem
                                {...formItemLayout}
                                    label="你觉得目前压力大吗"
                                >
                                {getFieldDecorator('stress', { initialValue:mainData.stress, rules: [{required: false, message: '不能为空'}],})(
                                    <Select placeholder="" className="widthCommon" getPopupContainer={triggerNode => triggerNode.parentNode}>
                                        <Option value={10}>没有压力</Option>
                                        <Option value={20}>一般压力</Option>
                                        <Option value={30}>很大压力</Option>
                                        <Option value={40}>几乎崩溃</Option>
                                    </Select>
                                )}
                                </FormItem>
                                { mainData.physicalExaminationDate && !this.props.editPower?null:<div className="footFix">
                                    <div className="footWidth">
                                        <span className="spanTips">未免数据丢失，请及时保存！</span>
                                        <Button type="primary" htmlType="submit">
                                            保存
                                        </Button>
                                    </div>
                                </div>}
                            </div>
                        </Form>
                    </div>
                </div>
                {mainData.physicalExaminationDate && !this.props.editPower ? <div className="footFix">
                    <div className="footWidth">
                        <Button type="primary" onClick={() => this.closeModal()}>
                            关闭
                        </Button>
                    </div>
                </div> : null}
            </div>
        );
    }
}

export default Form.create()(NewTable);
